
{************************************************************************************************************************}
{                                                                                                                        }
{                                                    XML Data Binding                                                    }
{                                                                                                                        }
{         Generated on: 2/7/2010 9:53:29 PM                                                                              }
{       Generated from: C:\Documents and Settings\Administrator\My Documents\RAD Studio\Projects\Migan\Translation.xml   }
{   Settings stored in: C:\Documents and Settings\Administrator\My Documents\RAD Studio\Projects\Migan\Translation.xdb   }
{                                                                                                                        }
{************************************************************************************************************************}

unit Translation;

interface

uses xmldom, XMLDoc, XMLIntf;

type

{ Forward Decls }

  IXMLTranslationType = interface;
  IXMLFormType = interface;
  IXMLItemType = interface;

{ IXMLTranslationType }

  IXMLTranslationType = interface(IXMLNodeCollection)
    ['{753A3012-B78F-41B0-B531-818AFE784266}']
    { Property Accessors }
    function Get_Form(Index: Integer): IXMLFormType;
    { Methods & Properties }
    function Add: IXMLFormType;
    function Insert(const Index: Integer): IXMLFormType;
    property Form[Index: Integer]: IXMLFormType read Get_Form; default;
  end;

{ IXMLFormType }

  IXMLFormType = interface(IXMLNodeCollection)
    ['{928DA92A-B5F2-459E-8FF8-4C57443CC5DE}']
    { Property Accessors }
    function Get_Name: WideString;
    function Get_Item(Index: Integer): IXMLItemType;
    procedure Set_Name(Value: WideString);
    { Methods & Properties }
    function Add: IXMLItemType;
    function Insert(const Index: Integer): IXMLItemType;
    property Name: WideString read Get_Name write Set_Name;
    property Item[Index: Integer]: IXMLItemType read Get_Item; default;
  end;

{ IXMLItemType }

  IXMLItemType = interface(IXMLNode)
    ['{9D235E13-5733-499C-BCEF-5BC7D4173E4D}']
    { Property Accessors }
    function Get_Name: WideString;
    function Get_Hebrew: WideString;
    function Get_English: WideString;
    procedure Set_Name(Value: WideString);
    procedure Set_Hebrew(Value: WideString);
    procedure Set_English(Value: WideString);
    { Methods & Properties }
    property Name: WideString read Get_Name write Set_Name;
    property Hebrew: WideString read Get_Hebrew write Set_Hebrew;
    property English: WideString read Get_English write Set_English;
  end;

{ Forward Decls }

  TXMLTranslationType = class;
  TXMLFormType = class;
  TXMLItemType = class;

{ TXMLTranslationType }

  TXMLTranslationType = class(TXMLNodeCollection, IXMLTranslationType)
  protected
    { IXMLTranslationType }
    function Get_Form(Index: Integer): IXMLFormType;
    function Add: IXMLFormType;
    function Insert(const Index: Integer): IXMLFormType;
  public
    procedure AfterConstruction; override;
  end;

{ TXMLFormType }

  TXMLFormType = class(TXMLNodeCollection, IXMLFormType)
  protected
    { IXMLFormType }
    function Get_Name: WideString;
    function Get_Item(Index: Integer): IXMLItemType;
    procedure Set_Name(Value: WideString);
    function Add: IXMLItemType;
    function Insert(const Index: Integer): IXMLItemType;
  public
    procedure AfterConstruction; override;
  end;

{ TXMLItemType }

  TXMLItemType = class(TXMLNode, IXMLItemType)
  protected
    { IXMLItemType }
    function Get_Name: WideString;
    function Get_Hebrew: WideString;
    function Get_English: WideString;
    procedure Set_Name(Value: WideString);
    procedure Set_Hebrew(Value: WideString);
    procedure Set_English(Value: WideString);
  end;

{ Global Functions }

function Gettranslation(Doc: IXMLDocument): IXMLTranslationType;
function Loadtranslation(const FileName: string): IXMLTranslationType;
function Newtranslation: IXMLTranslationType;

const
  TargetNamespace = '';

implementation

{ Global Functions }

function Gettranslation(Doc: IXMLDocument): IXMLTranslationType;
begin
  Result := Doc.GetDocBinding('translation', TXMLTranslationType, TargetNamespace) as IXMLTranslationType;
end;

function Loadtranslation(const FileName: string): IXMLTranslationType;
begin
  Result := LoadXMLDocument(FileName).GetDocBinding('translation', TXMLTranslationType, TargetNamespace) as IXMLTranslationType;
end;

function Newtranslation: IXMLTranslationType;
begin
  Result := NewXMLDocument.GetDocBinding('translation', TXMLTranslationType, TargetNamespace) as IXMLTranslationType;
end;

{ TXMLTranslationType }

procedure TXMLTranslationType.AfterConstruction;
begin
  RegisterChildNode('form', TXMLFormType);
  ItemTag := 'form';
  ItemInterface := IXMLFormType;
  inherited;
end;

function TXMLTranslationType.Get_Form(Index: Integer): IXMLFormType;
begin
  Result := List[Index] as IXMLFormType;
end;

function TXMLTranslationType.Add: IXMLFormType;
begin
  Result := AddItem(-1) as IXMLFormType;
end;

function TXMLTranslationType.Insert(const Index: Integer): IXMLFormType;
begin
  Result := AddItem(Index) as IXMLFormType;
end;

{ TXMLFormType }

procedure TXMLFormType.AfterConstruction;
begin
  RegisterChildNode('item', TXMLItemType);
  ItemTag := 'item';
  ItemInterface := IXMLItemType;
  inherited;
end;

function TXMLFormType.Get_Name: WideString;
begin
  Result := AttributeNodes['name'].Text;
end;

procedure TXMLFormType.Set_Name(Value: WideString);
begin
  SetAttribute('name', Value);
end;

function TXMLFormType.Get_Item(Index: Integer): IXMLItemType;
begin
  Result := List[Index] as IXMLItemType;
end;

function TXMLFormType.Add: IXMLItemType;
begin
  Result := AddItem(-1) as IXMLItemType;
end;

function TXMLFormType.Insert(const Index: Integer): IXMLItemType;
begin
  Result := AddItem(Index) as IXMLItemType;
end;

{ TXMLItemType }

function TXMLItemType.Get_Name: WideString;
begin
  Result := ChildNodes['name'].Text;
end;

procedure TXMLItemType.Set_Name(Value: WideString);
begin
  ChildNodes['name'].NodeValue := Value;
end;

function TXMLItemType.Get_Hebrew: WideString;
begin
  Result := ChildNodes['Hebrew'].Text;
end;

procedure TXMLItemType.Set_Hebrew(Value: WideString);
begin
  ChildNodes['Hebrew'].NodeValue := Value;
end;

function TXMLItemType.Get_English: WideString;
begin
  Result := ChildNodes['English'].Text;
end;

procedure TXMLItemType.Set_English(Value: WideString);
begin
  ChildNodes['English'].NodeValue := Value;
end;

end.